package chaos.infinity.mixin.Gunpowder;

import chaos.infinity.TheInfinityBlocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Objects;
@Mixin(Items.class)
public class GunpowderWireBlock_Mixin {
    @Inject(method = "register(Ljava/lang/String;)Lnet/minecraft/item/Item;",
              at = @At(value = "HEAD"), cancellable = true)
    private static void register(String id, CallbackInfoReturnable<Item> cir) {
        if (Objects.equals(id, "gunpowder")) {
            cir.setReturnValue(Items.register("gunpowder", ( settings ) -> { return new BlockItem(TheInfinityBlocks.GUNPOWDER_WIRE, settings); }, (new Item.Settings())));
        }
    }
}


